import 'package:safetymonitor/generated/json/base/json_convert_content.dart';
import 'package:safetymonitor/app/data/entities/application/maintenance_logs_entity.dart';

MaintenanceLogsEntity $MaintenanceLogsEntityFromJson(Map<String, dynamic> json) {
  final MaintenanceLogsEntity maintenanceLogsEntity = MaintenanceLogsEntity();
  final int? id = jsonConvert.convert<int>(json['id']);
  if (id != null) {
    maintenanceLogsEntity.id = id;
  }
  final String? maintenanceRecords = jsonConvert.convert<String>(json['maintenanceRecords']);
  if (maintenanceRecords != null) {
    maintenanceLogsEntity.maintenanceRecords = maintenanceRecords;
  }
  final String? operators = jsonConvert.convert<String>(json['operators']);
  if (operators != null) {
    maintenanceLogsEntity.operators = operators;
  }
  final String? recordPersonnel = jsonConvert.convert<String>(json['recordPersonnel']);
  if (recordPersonnel != null) {
    maintenanceLogsEntity.recordPersonnel = recordPersonnel;
  }
  final String? operationTime = jsonConvert.convert<String>(json['operationTime']);
  if (operationTime != null) {
    maintenanceLogsEntity.operationTime = operationTime;
  }
  final bool? allowOperations = jsonConvert.convert<bool>(json['allowOperations']);
  if (allowOperations != null) {
    maintenanceLogsEntity.allowOperations = allowOperations;
  }
  return maintenanceLogsEntity;
}

Map<String, dynamic> $MaintenanceLogsEntityToJson(MaintenanceLogsEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['maintenanceRecords'] = entity.maintenanceRecords;
  data['operators'] = entity.operators;
  data['recordPersonnel'] = entity.recordPersonnel;
  data['operationTime'] = entity.operationTime;
  data['allowOperations'] = entity.allowOperations;
  return data;
}

extension MaintenanceLogsEntityExtension on MaintenanceLogsEntity {
  MaintenanceLogsEntity copyWith({
    int? id,
    String? maintenanceRecords,
    String? operators,
    String? recordPersonnel,
    String? operationTime,
    bool? allowOperations,
  }) {
    return MaintenanceLogsEntity()
      ..id = id ?? this.id
      ..maintenanceRecords = maintenanceRecords ?? this.maintenanceRecords
      ..operators = operators ?? this.operators
      ..recordPersonnel = recordPersonnel ?? this.recordPersonnel
      ..operationTime = operationTime ?? this.operationTime
      ..allowOperations = allowOperations ?? this.allowOperations;
  }
}